<template>
    <lemon-common uri="${path}" ref="commonRef" :search-form-model="searchFormModel" :search-form-item="searchFormItem" :search-condition="searchCondition" :show-search="false" :show-clear="false" :show-add="false" search-permission="" add-permission="" data="null" :table-item="tableItem" :show-info="false" :show-edit="false" :show-enable="false" :show-unable="false" :show-del="false" info-permission="" edit-permission="" enable-permission="" unable-permission="" del-permission="" :dialog-info-form-model="dialogInfoFormModel" :dialog-info-form-item="dialogInfoFormItem" :dialog-edit-form-model="dialogEditFormModel" :dialog-edit-form-item="dialogEditFormItem" :dialog-add-form-model="dialogAddFormModel" :dialog-add-form-item="dialogAddFormItem"></lemon-common>
</template>

<script setup lang="ts">
import { reactive, inject, ref } from "vue";

//获取自定义全局方法
const { rule } = inject<any>("method");

//公共组件ref
const commonRef: any = ref(null);

//搜索的form
const searchFormModel = reactive({
    <#list columns as column>
    <#if column.javaType == "String">
    ${column.javaName}: "",
    <#else>
    ${column.javaName}: null,
    </#if>
    </#list>
});

//搜索form子项
const searchFormItem = reactive({
    <#list columns as column>
    ${column.javaName}: { label: "${column.columnComment}", type: "input", clearable: true },
    </#list>
});

//搜索的条件
const searchCondition = reactive({
    <#list columns as column>
    ${column.javaName}: "eq",
    </#list>
});

//表格每一项
const tableItem = reactive([
    <#list columns as column>
    { prop: "${column.javaName}", label: "${column.columnComment}", minWidth: "150" },
    </#list>
]);

//弹出框详情form
const dialogInfoFormModel = reactive({
    <#list columns as column>
    <#if column.javaType == "String">
    ${column.javaName}: "",
    <#else>
    ${column.javaName}: null,
    </#if>
    </#list>
});

//弹出框详情form子项
const dialogInfoFormItem = reactive({
    <#list columns as column>
    ${column.javaName}: { label: "${column.columnComment}", type: "input", readonly: true },
    </#list>
});

//弹出框编辑form
const dialogEditFormModel = reactive({
    <#list columns as column>
    <#if column.javaType == "String">
    ${column.javaName}: "",
    <#else>
    ${column.javaName}: null,
    </#if>
    </#list>
});

//弹出框编辑form子项
const dialogEditFormItem = reactive({
    <#list columns as column>
    ${column.javaName}: { label: "${column.columnComment}", type: "input" },
    </#list>
});

//弹出框添加form
const dialogAddFormModel = reactive({
    <#list columns as column>
    <#if column.javaType == "String">
    ${column.javaName}: "",
    <#else>
    ${column.javaName}: null,
    </#if>
    </#list>
});

//弹出框添加form子项
const dialogAddFormItem = reactive({
    <#list columns as column>
    ${column.javaName}: { label: "${column.columnComment}", type: "input" },
    </#list>
});
</script>

<style scoped lang="less"></style>
